package Chapter8;

//171页程序8.7

import java.awt.*;
import javax.swing.*;

public class BorderLayoutDemo {
    private JFrame frame;
    private JButton be, bw, bn, bs, bc;

    public static void main(String[] args) {
        BorderLayoutDemo that = new BorderLayoutDemo();
        that.go();
    }

    void go() {
        frame = new JFrame("BorderLayout测试程序");
        be = new JButton("东");
        bs = new JButton("南");
        bw = new JButton("西");
        bn = new JButton("北");
        bc = new JButton("中");
        frame.getContentPane().add(be, BorderLayout.EAST);
        frame.getContentPane().add(bs, BorderLayout.SOUTH);
        frame.getContentPane().add(bw, BorderLayout.WEST);
        frame.getContentPane().add(bn, BorderLayout.NORTH);
        frame.getContentPane().add(bc, BorderLayout.CENTER);
        frame.setSize(350, 200);
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}
